home *** CD-ROM | disk | FTP | other *** search
/ Chip 2007 January, February, March & April / Chip-Cover-CD-2007-02.iso / Pakiet bezpieczenstwa / mini Pentoo LiveCD 2006.1 / mpentoo-2006.1.iso / livecd.squashfs / usr / lib / mozilla-firefox / include / necko / nsIProtocolProxyService.h < prev    next >
C/C++ Source or Header  |  2006-05-08  |  15KB  |  318 lines

  1. /*
  2.  * DO NOT EDIT.  THIS FILE IS GENERATED FROM nsIProtocolProxyService.idl
  3.  */
  4.  
  5. #ifndef __gen_nsIProtocolProxyService_h__
  6. #define __gen_nsIProtocolProxyService_h__
  7.  
  8.  
  9. #ifndef __gen_nsISupports_h__
  10. #include "nsISupports.h"
  11. #endif
  12.  
  13. /* For IDL files that don't want to include root IDL files. */
  14. #ifndef NS_NO_VTABLE
  15. #define NS_NO_VTABLE
  16. #endif
  17. class nsICancelable; /* forward declaration */
  18.  
  19. class nsIProtocolProxyCallback; /* forward declaration */
  20.  
  21. class nsIProtocolProxyFilter; /* forward declaration */
  22.  
  23. class nsIProxyInfo; /* forward declaration */
  24.  
  25. class nsIChannel; /* forward declaration */
  26.  
  27. class nsIURI; /* forward declaration */
  28.  
  29.  
  30. /* starting interface:    nsIProtocolProxyService */
  31. #define NS_IPROTOCOLPROXYSERVICE_IID_STR "e38ab577-786e-4a7f-936b-7ae4c7d877b2"
  32.  
  33. #define NS_IPROTOCOLPROXYSERVICE_IID \
  34.   {0xe38ab577, 0x786e, 0x4a7f, \
  35.     { 0x93, 0x6b, 0x7a, 0xe4, 0xc7, 0xd8, 0x77, 0xb2 }}
  36.  
  37. /**
  38.  * nsIProtocolProxyService provides methods to access information about
  39.  * various network proxies.
  40.  *
  41.  * @status UNDER_REVIEW
  42.  */
  43. class NS_NO_VTABLE nsIProtocolProxyService : public nsISupports {
  44.  public: 
  45.  
  46.   NS_DEFINE_STATIC_IID_ACCESSOR(NS_IPROTOCOLPROXYSERVICE_IID)
  47.  
  48.   /**
  49.      * This flag may be passed to the resolve method to request that it fail
  50.      * instead of block the calling thread.  Proxy Auto Config (PAC) may
  51.      * perform a synchronous DNS query, which may not return immediately.  So,
  52.      * calling resolve without this flag may result in locking up the calling
  53.      * thread for a lengthy period of time.
  54.      *
  55.      * By passing this flag to resolve, one can failover to asyncResolve to
  56.      * avoid locking up the calling thread if a PAC query is required.
  57.      *
  58.      * When this flag is passed to resolve, resolve may throw the exception
  59.      * NS_BASE_STREAM_WOULD_BLOCK to indicate that it failed due to this flag
  60.      * being present.
  61.      */
  62.   enum { RESOLVE_NON_BLOCKING = 1U };
  63.  
  64.   /**
  65.      * This method returns a nsIProxyInfo instance that identifies a proxy to
  66.      * be used for loading the given URI.  Otherwise, this method returns null
  67.      * indicating that a direct connection should be used.
  68.      *
  69.      * @param aURI
  70.      *        The URI to test.
  71.      * @param aFlags
  72.      *        A bit-wise OR of the RESOLVE_ flags defined above.  Pass 0 to
  73.      *        specify the default behavior.
  74.      *
  75.      * NOTE: If this proxy is unavailable, getFailoverForProxy may be called
  76.      * to determine the correct secondary proxy to be used.
  77.      *
  78.      * NOTE: If the protocol handler for the given URI supports
  79.      * nsIProxiedProtocolHandler, then the nsIProxyInfo instance returned from
  80.      * resolve may be passed to the newProxiedChannel method to create a
  81.      * nsIChannel to the given URI that uses the specified proxy.
  82.      *
  83.      * NOTE: However, if the nsIProxyInfo type is "http", then it means that
  84.      * the given URI should be loaded using the HTTP protocol handler, which
  85.      * also supports nsIProxiedProtocolHandler.
  86.      *
  87.      * NOTE: If PAC is configured, and the PAC file has not yet been loaded,
  88.      * then this method will return a nsIProxyInfo instance with a type of
  89.      * "unknown" to indicate to the consumer that asyncResolve should be used
  90.      * to wait for the PAC file to finish loading.  Otherwise, the consumer
  91.      * may choose to treat the result as type "direct" if desired.
  92.      *
  93.      * @see nsIProxiedProtocolHandler::newProxiedChannel 
  94.      */
  95.   /* nsIProxyInfo resolve (in nsIURI aURI, in unsigned long aFlags); */
  96.   NS_IMETHOD Resolve(nsIURI *aURI, PRUint32 aFlags, nsIProxyInfo **_retval) = 0;
  97.  
  98.   /**
  99.      * This method is an asychronous version of the resolve method.  Unlike
  100.      * resolve, this method is guaranteed not to block the calling thread
  101.      * waiting for DNS queries to complete.  This method is intended as a
  102.      * substitute for resolve when the result is not needed immediately.
  103.      *
  104.      * @param aURI
  105.      *        The URI to test.
  106.      * @param aFlags
  107.      *        A bit-wise OR of the RESOLVE_ flags defined above.  Pass 0 to
  108.      *        specify the default behavior.
  109.      * @param aCallback
  110.      *        The object to be notified when the result is available.
  111.      *
  112.      * @return An object that can be used to cancel the asychronous operation.
  113.      */
  114.   /* nsICancelable asyncResolve (in nsIURI aURI, in unsigned long aFlags, in nsIProtocolProxyCallback aCallback); */
  115.   NS_IMETHOD AsyncResolve(nsIURI *aURI, PRUint32 aFlags, nsIProtocolProxyCallback *aCallback, nsICancelable **_retval) = 0;
  116.  
  117.   /**
  118.      * This method may be called to construct a nsIProxyInfo instance from
  119.      * the given parameters.  This method may be useful in conjunction with
  120.      * nsISocketTransportService::createTransport for creating, for example,
  121.      * a SOCKS connection.
  122.      *
  123.      * @param aType
  124.      *        The proxy type.  This is a string value that identifies the proxy
  125.      *        type.  Standard values include:
  126.      *          "http"    - specifies a HTTP proxy
  127.      *          "socks"   - specifies a SOCKS version 5 proxy
  128.      *          "socks4"  - specifies a SOCKS version 4 proxy
  129.      *          "direct"  - specifies a direct connection (useful for failover)
  130.      *        The type name is case-insensitive.  Other string values may be
  131.      *        possible.
  132.      * @param aHost
  133.      *        The proxy hostname or IP address.
  134.      * @param aPort
  135.      *        The proxy port.
  136.      * @param aFlags
  137.      *        Flags associated with this connection.  See nsIProxyInfo.idl
  138.      *        for currently defined flags.
  139.      * @param aFailoverTimeout
  140.      *        Specifies the length of time (in seconds) to ignore this proxy if
  141.      *        this proxy fails.  Pass PR_UINT32_MAX to specify the default
  142.      *        timeout value, causing nsIProxyInfo::failoverTimeout to be
  143.      *        assigned the default value.
  144.      * @param aFailoverProxy
  145.      *        Specifies the next proxy to try if this proxy fails.  This
  146.      *        parameter may be null.
  147.      */
  148.   /* nsIProxyInfo newProxyInfo (in ACString aType, in AUTF8String aHost, in long aPort, in unsigned long aFlags, in unsigned long aFailoverTimeout, in nsIProxyInfo aFailoverProxy); */
  149.   NS_IMETHOD NewProxyInfo(const nsACString & aType, const nsACString & aHost, PRInt32 aPort, PRUint32 aFlags, PRUint32 aFailoverTimeout, nsIProxyInfo *aFailoverProxy, nsIProxyInfo **_retval) = 0;
  150.  
  151.   /**
  152.      * If the proxy identified by aProxyInfo is unavailable for some reason,
  153.      * this method may be called to access an alternate proxy that may be used
  154.      * instead.  As a side-effect, this method may affect future result values
  155.      * from resolve/asyncResolve as well as from getFailoverForProxy.
  156.      *
  157.      * @param aProxyInfo
  158.      *        The proxy that was unavailable.
  159.      * @param aURI
  160.      *        The URI that was originally passed to resolve/asyncResolve.
  161.      * @param aReason
  162.      *        The error code corresponding to the proxy failure.  This value
  163.      *        may be used to tune the delay before this proxy is used again.
  164.      *
  165.      * @throw NS_ERROR_NOT_AVAILABLE if there is no alternate proxy available.
  166.      */
  167.   /* nsIProxyInfo getFailoverForProxy (in nsIProxyInfo aProxyInfo, in nsIURI aURI, in nsresult aReason); */
  168.   NS_IMETHOD GetFailoverForProxy(nsIProxyInfo *aProxyInfo, nsIURI *aURI, nsresult aReason, nsIProxyInfo **_retval) = 0;
  169.  
  170.   /**
  171.      * This method may be used to register a proxy filter instance.  Each proxy
  172.      * filter is registered with an associated position that determines the
  173.      * order in which the filters are applied (starting from position 0).  When
  174.      * resolve/asyncResolve is called, it generates a list of proxies for the
  175.      * given URI, and then it applies the proxy filters.  The filters have the
  176.      * opportunity to modify the list of proxies.
  177.      *
  178.      * If two filters register for the same position, then the filters will be
  179.      * visited in the order in which they were registered.
  180.      *
  181.      * If the filter is already registered, then its position will be updated.
  182.      *
  183.      * After filters have been run, any disabled or disallowed proxies will be
  184.      * removed from the list.  A proxy is disabled if it had previously failed-
  185.      * over to another proxy (see getFailoverForProxy).  A proxy is disallowed,
  186.      * for example, if it is a HTTP proxy and the nsIProtocolHandler for the
  187.      * queried URI does not permit proxying via HTTP.
  188.      *
  189.      * If a nsIProtocolHandler disallows all proxying, then filters will never
  190.      * have a chance to intercept proxy requests for such URLs.
  191.      *
  192.      * @param aFilter
  193.      *        The nsIProtocolProxyFilter instance to be registered.
  194.      * @param aPosition
  195.      *        The position of the filter.
  196.      *
  197.      * NOTE: It is possible to construct filters that compete with one another
  198.      * in undesirable ways.  This API does not attempt to protect against such
  199.      * problems.  It is recommended that any extensions that choose to call
  200.      * this method make their position value configurable at runtime (perhaps
  201.      * via the preferences service).
  202.      */
  203.   /* void registerFilter (in nsIProtocolProxyFilter aFilter, in unsigned long aPosition); */
  204.   NS_IMETHOD RegisterFilter(nsIProtocolProxyFilter *aFilter, PRUint32 aPosition) = 0;
  205.  
  206.   /**
  207.      * This method may be used to unregister a proxy filter instance.  All
  208.      * filters will be automatically unregistered at XPCOM shutdown.
  209.      *
  210.      * @param aFilter
  211.      *        The nsIProtocolProxyFilter instance to be unregistered.
  212.      */
  213.   /* void unregisterFilter (in nsIProtocolProxyFilter aFilter); */
  214.   NS_IMETHOD UnregisterFilter(nsIProtocolProxyFilter *aFilter) = 0;
  215.  
  216. };
  217.  
  218. /* Use this macro when declaring classes that implement this interface. */
  219. #define NS_DECL_NSIPROTOCOLPROXYSERVICE \
  220.   NS_IMETHOD Resolve(nsIURI *aURI, PRUint32 aFlags, nsIProxyInfo **_retval); \
  221.   NS_IMETHOD AsyncResolve(nsIURI *aURI, PRUint32 aFlags, nsIProtocolProxyCallback *aCallback, nsICancelable **_retval); \
  222.   NS_IMETHOD NewProxyInfo(const nsACString & aType, const nsACString & aHost, PRInt32 aPort, PRUint32 aFlags, PRUint32 aFailoverTimeout, nsIProxyInfo *aFailoverProxy, nsIProxyInfo **_retval); \
  223.   NS_IMETHOD GetFailoverForProxy(nsIProxyInfo *aProxyInfo, nsIURI *aURI, nsresult aReason, nsIProxyInfo **_retval); \
  224.   NS_IMETHOD RegisterFilter(nsIProtocolProxyFilter *aFilter, PRUint32 aPosition); \
  225.   NS_IMETHOD UnregisterFilter(nsIProtocolProxyFilter *aFilter); 
  226.  
  227. /* Use this macro to declare functions that forward the behavior of this interface to another object. */
  228. #define NS_FORWARD_NSIPROTOCOLPROXYSERVICE(_to) \
  229.   NS_IMETHOD Resolve(nsIURI *aURI, PRUint32 aFlags, nsIProxyInfo **_retval) { return _to Resolve(aURI, aFlags, _retval); } \
  230.   NS_IMETHOD AsyncResolve(nsIURI *aURI, PRUint32 aFlags, nsIProtocolProxyCallback *aCallback, nsICancelable **_retval) { return _to AsyncResolve(aURI, aFlags, aCallback, _retval); } \
  231.   NS_IMETHOD NewProxyInfo(const nsACString & aType, const nsACString & aHost, PRInt32 aPort, PRUint32 aFlags, PRUint32 aFailoverTimeout, nsIProxyInfo *aFailoverProxy, nsIProxyInfo **_retval) { return _to NewProxyInfo(aType, aHost, aPort, aFlags, aFailoverTimeout, aFailoverProxy, _retval); } \
  232.   NS_IMETHOD GetFailoverForProxy(nsIProxyInfo *aProxyInfo, nsIURI *aURI, nsresult aReason, nsIProxyInfo **_retval) { return _to GetFailoverForProxy(aProxyInfo, aURI, aReason, _retval); } \
  233.   NS_IMETHOD RegisterFilter(nsIProtocolProxyFilter *aFilter, PRUint32 aPosition) { return _to RegisterFilter(aFilter, aPosition); } \
  234.   NS_IMETHOD UnregisterFilter(nsIProtocolProxyFilter *aFilter) { return _to UnregisterFilter(aFilter); } 
  235.  
  236. /* Use this macro to declare functions that forward the behavior of this interface to another object in a safe way. */
  237. #define NS_FORWARD_SAFE_NSIPROTOCOLPROXYSERVICE(_to) \
  238.   NS_IMETHOD Resolve(nsIURI *aURI, PRUint32 aFlags, nsIProxyInfo **_retval) { return !_to ? NS_ERROR_NULL_POINTER : _to->Resolve(aURI, aFlags, _retval); } \
  239.   NS_IMETHOD AsyncResolve(nsIURI *aURI, PRUint32 aFlags, nsIProtocolProxyCallback *aCallback, nsICancelable **_retval) { return !_to ? NS_ERROR_NULL_POINTER : _to->AsyncResolve(aURI, aFlags, aCallback, _retval); } \
  240.   NS_IMETHOD NewProxyInfo(const nsACString & aType, const nsACString & aHost, PRInt32 aPort, PRUint32 aFlags, PRUint32 aFailoverTimeout, nsIProxyInfo *aFailoverProxy, nsIProxyInfo **_retval) { return !_to ? NS_ERROR_NULL_POINTER : _to->NewProxyInfo(aType, aHost, aPort, aFlags, aFailoverTimeout, aFailoverProxy, _retval); } \
  241.   NS_IMETHOD GetFailoverForProxy(nsIProxyInfo *aProxyInfo, nsIURI *aURI, nsresult aReason, nsIProxyInfo **_retval) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetFailoverForProxy(aProxyInfo, aURI, aReason, _retval); } \
  242.   NS_IMETHOD RegisterFilter(nsIProtocolProxyFilter *aFilter, PRUint32 aPosition) { return !_to ? NS_ERROR_NULL_POINTER : _to->RegisterFilter(aFilter, aPosition); } \
  243.   NS_IMETHOD UnregisterFilter(nsIProtocolProxyFilter *aFilter) { return !_to ? NS_ERROR_NULL_POINTER : _to->UnregisterFilter(aFilter); } 
  244.  
  245. #if 0
  246. /* Use the code below as a template for the implementation class for this interface. */
  247.  
  248. /* Header file */
  249. class nsProtocolProxyService : public nsIProtocolProxyService
  250. {
  251. public:
  252.   NS_DECL_ISUPPORTS
  253.   NS_DECL_NSIPROTOCOLPROXYSERVICE
  254.  
  255.   nsProtocolProxyService();
  256.  
  257. private:
  258.   ~nsProtocolProxyService();
  259.  
  260. protected:
  261.   /* additional members */
  262. };
  263.  
  264. /* Implementation file */
  265. NS_IMPL_ISUPPORTS1(nsProtocolProxyService, nsIProtocolProxyService)
  266.  
  267. nsProtocolProxyService::nsProtocolProxyService()
  268. {
  269.   /* member initializers and constructor code */
  270. }
  271.  
  272. nsProtocolProxyService::~nsProtocolProxyService()
  273. {
  274.   /* destructor code */
  275. }
  276.  
  277. /* nsIProxyInfo resolve (in nsIURI aURI, in unsigned long aFlags); */
  278. NS_IMETHODIMP nsProtocolProxyService::Resolve(nsIURI *aURI, PRUint32 aFlags, nsIProxyInfo **_retval)
  279. {
  280.     return NS_ERROR_NOT_IMPLEMENTED;
  281. }
  282.  
  283. /* nsICancelable asyncResolve (in nsIURI aURI, in unsigned long aFlags, in nsIProtocolProxyCallback aCallback); */
  284. NS_IMETHODIMP nsProtocolProxyService::AsyncResolve(nsIURI *aURI, PRUint32 aFlags, nsIProtocolProxyCallback *aCallback, nsICancelable **_retval)
  285. {
  286.     return NS_ERROR_NOT_IMPLEMENTED;
  287. }
  288.  
  289. /* nsIProxyInfo newProxyInfo (in ACString aType, in AUTF8String aHost, in long aPort, in unsigned long aFlags, in unsigned long aFailoverTimeout, in nsIProxyInfo aFailoverProxy); */
  290. NS_IMETHODIMP nsProtocolProxyService::NewProxyInfo(const nsACString & aType, const nsACString & aHost, PRInt32 aPort, PRUint32 aFlags, PRUint32 aFailoverTimeout, nsIProxyInfo *aFailoverProxy, nsIProxyInfo **_retval)
  291. {
  292.     return NS_ERROR_NOT_IMPLEMENTED;
  293. }
  294.  
  295. /* nsIProxyInfo getFailoverForProxy (in nsIProxyInfo aProxyInfo, in nsIURI aURI, in nsresult aReason); */
  296. NS_IMETHODIMP nsProtocolProxyService::GetFailoverForProxy(nsIProxyInfo *aProxyInfo, nsIURI *aURI, nsresult aReason, nsIProxyInfo **_retval)
  297. {
  298.     return NS_ERROR_NOT_IMPLEMENTED;
  299. }
  300.  
  301. /* void registerFilter (in nsIProtocolProxyFilter aFilter, in unsigned long aPosition); */
  302. NS_IMETHODIMP nsProtocolProxyService::RegisterFilter(nsIProtocolProxyFilter *aFilter, PRUint32 aPosition)
  303. {
  304.     return NS_ERROR_NOT_IMPLEMENTED;
  305. }
  306.  
  307. /* void unregisterFilter (in nsIProtocolProxyFilter aFilter); */
  308. NS_IMETHODIMP nsProtocolProxyService::UnregisterFilter(nsIProtocolProxyFilter *aFilter)
  309. {
  310.     return NS_ERROR_NOT_IMPLEMENTED;
  311. }
  312.  
  313. /* End of implementation class template. */
  314. #endif
  315.  
  316.  
  317. #endif /* __gen_nsIProtocolProxyService_h__ */
  318.